package com.api.compatibility.group;

import org.springframework.test.context.ContextConfiguration;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;

import com.api.test.AbstractApiTest;
import com.api.test.VoidContextLoader;
import com.api.util.repo.impl.DomainUser;
import com.zyncro.api.exceptions.ZyncroApiException;

@ContextConfiguration(loader = VoidContextLoader.class)
public class AddMemberCompatibility extends AbstractApiTest {

	private String groupUrn;

	private String userAppId;

	@BeforeClass
	protected void setUp() throws Exception {

		DomainUser mainAdmin = getRepo().getMainUser("Groups");
		getApi().login(mainAdmin.getAppId(), mainAdmin.getPassword());

		// ApiRequestBuilder request = getRequest(IGroupApiService.class, "createGroup");
		// request.setParam("name", "new Group");
		// ObjectResultApi<String> response = getApi().send(request);
		//
		// this.groupUrn = response.getObject();
		//
		// PagedItemsResultApi<UserApi> contacts = getApi().getService(IUserApiService.class).getContacts(0, 0,
		// UserFilterApiType.ONLY_ORGANIZATION_CONTACTS);
		//
		// String email = "useremail" + contacts.getTotalItems() + "-Groups@yopmail.com";
		//
		// ApiRequestBuilder
	}

	@Test
	public void testGetAllGroups() throws ZyncroApiException {

		// ApiRequestBuilder requestBuilder = getRequest(IGroupApiService.class, "getGroups");
		// getApi().signRequest(requestBuilder);
		//
		// ApiRequest request = requestBuilder.getRequest();
		// Assert.assertTrue(request.getUrl().endsWith("/api/v1/rest/groups"), "Request url");
		//
		// ApiResponse response = request.send();
		//
		// Assert.assertEquals(response.getCode(), 200, "Response code");
		// Assert.assertNotNull(response.getBody(), "Response body");
		// Assert.assertNotEquals(response.getBody(), "", "Response body");

		System.out.println(this.groupUrn);
	}
}
